package com.russell.pms.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.russell.pms.dao.MaintenanceDao;
import com.russell.pms.dao.PropertyDao;
import com.russell.pms.model.Maintenance;
import com.russell.pms.service.MaintenanceService;

@Service("maintenanceService")
@Transactional(readOnly = true)
public class MaintenanceServiceImpl extends BaseService implements MaintenanceService{

	@Autowired
	private PropertyDao propertyDao;
	@Autowired
	private MaintenanceDao maintenanceDao;
	
	public void setPropertyDao(PropertyDao propertyDao) {
		this.propertyDao = propertyDao;
	}
	
	public void setMaintenanceDao(MaintenanceDao maintenanceDao) {
		this.maintenanceDao = maintenanceDao;
	}
	
	@Override
	public Maintenance getMaintenance(int maintID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Maintenance> getMaintenances() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void removeMaintenance(int maintId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeMaintenance(Maintenance maintenance) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Transactional(value = "pms", readOnly = false, propagation = Propagation.REQUIRES_NEW, rollbackFor = java.lang.Exception.class)
	public void saveMaintenance(Maintenance maintenance) {
//		propertyDao.getProperty(maintenance.getProp_id());
		// TODO add getVendor to make sure the vendor id is valid
		maintenanceDao.saveMaintenance(maintenance);
	}

	@Override
	public void updateMaintenance(Maintenance maintenance) {
		// TODO Auto-generated method stub
		
	}

}
